package cn.theten52.demo.patterns.design.behavior.mediation.update2;

/**
 * 具体中介者类
 *
 * @author wangjin
 * @date 2021/4/3
 */
public class MasterMediator extends Mediator {
    private Wudang wudang;
    private Emei emei;
    private Shaolin shaolin;

    public void setWudang(Wudang wudang) {
        this.wudang = wudang;
    }

    public void setEmei(Emei emei) {
        this.emei = emei;
    }

    public void setShaolin(Shaolin shaolin) {
        this.shaolin = shaolin;
    }

    @Override
    public void notice(String message, Colleague colleague) {
        if (colleague == wudang) {
            shaolin.getNotice(message);
        } else if (colleague == emei) {
            shaolin.getNotice(message);
        } else if (colleague == shaolin) {
            wudang.getNotice(message);
            emei.getNotice(message);
        }
    }
}

